<template>
	<view>
		<button type="default" @click="openLogin">登录页</button>
		<view>
			{{user ? user.username : '未登录'}}
		</view>
	</view>
</template>

<script>
	// import {
	// 	mapState
	// } from 'vuex';
	export default {
		data() {
			return {
				user: null
			}
		},
		// computed: {
		// 	...mapState({
		// 		user: state => state.user
		// 	})
		// },
		created() {
			this.user = this.$store.state.user
			console.log(this.user)
		},
		methods: {
			openLogin() {
				uni.navigateTo({
					url: '../../login/login'
				});
			}
		}
	}
</script>

<style>

</style>
